<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="hibernate.constraint.Constraint"%>
<%@ page import="javax.servlet.http.HttpSession"%>
<%@ page import="java.io.PrintWriter"%>

<%@page import="hibernate.constraint.Constraint"%>
<%@ page import="org.hibernate.SessionFactory"%>
<%@ page import="org.hibernate.Session"%>
<%@ page import="java.util.List"%>
<%@ page import="hibernate.model.*"%>
<%@ page import="hibernate.util.HibernateUtil"%>
<%@ page import="hibernate.method.*"%>

<%
	SessionFactory sessionFactory = HibernateUtil
			.getSessionAnnotationFactory();
	Session s = sessionFactory.openSession();
	s.beginTransaction();
	UserMethods user_m = new UserMethods();
%>

<meta charset="UTF-8">
<div class="container language-select visible-md visible-lg">
	<div class="row">
		<div class="col-md-12">
		
		
			
				<%
					Integer user_id = (Integer) session.getAttribute("user_id");
					response.setContentType("text/html");
					if (user_id != null) {
		
			User u = user_m.id_to_user(sessionFactory, s, user_id);
		
				
		out.print("<form action=\"logoutPanel.jsp\">");
		out.print("Witaj " + u.getName() + " !");
		out.print("<input id=\"logout_submit\" class=\"mainBtn\" type=\"submit\" value=\"Wyloguj\">");
		out.print("</form>");
		//		out.println("<a href='logoutPanel.jsp' class=\"mainBtn\"> Wyloguj się</a>");
				} else {
			%>
<form name="Login" action="../Login" method="POST">
<label for="username">User Name:</label>
			 <input name="username" type="text" class="input"
				id="username" required placeholder="enter your user name" />
			
	<label for="password">Password:</label>	
			 <input name="password" type="password" class="input"
				id="password" required placeholder="password" />
			
		<input id="login_submit" class="mainBtn" type="submit" value="zaloguj">
		<br />
	<label for="tip">Problem z zalogowaniem?</label>
		<!-- <hr noshade="noshade" width="20px" align="right" /> -->
		<a href="register.jsp">Zarejestruj się</a>   ||  
		  <a href="passwordReminder.jsp">Zapomniałem hasła</a>
	
		<%
			}
		%>
	</form>
		<!--   <select name="cat2" id="cat2" class="postform">
                    <option value="0">-- Language Selection --</option>
                    <option class="level-0" value="1">English</option>
                    <option class="level-0" value="2">Myanmar</option>
                </select>
                -->


	</div>
	<!-- /.col-md-12 -->
</div>
<!-- /.row -->
</div>
<!-- /.language-select -->